import request from '@/utils/request'
export default{
  getStockList(searchModel) {
    const params = {};
   
    if (searchModel.id) {
      params.id = searchModel.id;
    }
    params.pageNo = searchModel.pageNo;
    params.pageSize = searchModel.pageSize;
    return request({
      url: '/stock/List',
      method: 'get',
      params: params
    });
  },
    deleteStock(number){
        return request({
            url: `/stock/${number}`,
            method: 'delete',
          });
    },
      // 新增
      addStock(stock){
        return request({
          url: '/stock',
          method: 'post',
          data: stock
        });
      },
      // 修改
      updateStock(stock){
        return request({
          url: '/stock',
          method: 'put',
          data: stock
        });
      },
      // 保存角色数据
      saveStock(stock){
        if(stock.id == null || stock.id == undefined){
          return this.addStock(stock);
        }
        return this.updateStock(stock);
      },
      // 根据id查询
      getByStockId(id){
        return request({
          url: `/stock/${id}`,
          method: 'get'
        });
      },
      


}